<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%--
	auth : Conner
	date : 2012-09-09
	desc : 系统消息设置列表
--%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="/admin/common/css/style_sub.jsp"></jsp:include>
<script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/public.js"></script>
<script language="javascript">
//更新系统消息设置状态
function updateSysSetInfoState(bCode, status){
	var params = {
			ct : getCurrentTime(),
			'sysSetInfo.bCode' : bCode,
			'sysSetInfo.state' : status
	};
	$.getJSON('<%=basePath%>basic/sys/msgSet_updateSysSetInfoStatus.action', params, function(json){
		if(json.resultCode == 'success'){
			alert("改变系统消息设置状态成功！");
			$('#searchBtn').click();
		}else{
			alert("改变系统消息设置状态失败，请联系管理员！");
		}
	});
}

//点击行看明细
function goDetail(bCode){
	var url;
	url = "<%=basePath%>basic/sys/msgSet_findOneByBcode.action?sysSetInfo.bCode=" + bCode + "&type=detail";
	document.location.href = url;
}


//编辑
function edit(url){
	document.location.href = url;
}
</script>
</head>
<body>
	<form action="<%=basePath%>basic/sys/msgSet_selectSysSetInfo.action" id="sf" method="post">
		<div class="searchTab">
			<table>
				<tr>
					<th>类型编号</th>
					<td>
						<input type="text" name="sysSetInfo.bCode" value="${sysSetInfo.bCode}"/>
					</td>
					<th>短信提醒</th>
					<td>
						<label><input type="radio" name="sysSetInfo.isNote" value="1" 
							<s:if test='%{sysSetInfo.isNote == "1"}'>checked="checked"</s:if>/>&nbsp;是</label>&nbsp;&nbsp;
						<label><input type="radio" name="sysSetInfo.isNote" value="2" 
							<s:if test='%{sysSetInfo.isNote == "2"}'>checked="checked"</s:if>/>&nbsp;否</label>
					</td>
				</tr>
				<tr>
					<th>当前状态</th>
					<td>
						<label><input type="radio" name="sysSetInfo.state" value="1" 
							<s:if test='%{sysSetInfo.state == "1"}'>checked="checked"</s:if>/>
						<img src="<%=basePath%>style/icons/ok.png" title="启用" alt="启用" 
							align="absmiddle"/></label>&nbsp;&nbsp;&nbsp;&nbsp;
						<label><input type="radio" name="sysSetInfo.state" value="2" 
							<s:if test='%{sysSetInfo.state == "2"}'>checked="checked"</s:if>/>
						<img src="<%=basePath%>style/icons/pause.png" title="停用" alt="停用" align="absmiddle"/></label>
					</td>
					<th>&nbsp;</th>
					<td>
						<span class="btn"><input type="submit" id="searchBtn" value="查询"/></span>
						<span class="btn">
							<input type="button" value="添加系统消息设置" 
								onclick="javascript:window.location.href = '<%=basePath%>admin/basic/system/msg/msgSet_add.jsp'"/>
						</span>
						<span class="btn"><input type="button" value="删除所选" 
							onclick="javascript:del('<%=basePath%>basic/sys/msgSet_delete.action');"/></span>
					</td>
				</tr>
			</table>
		</div>
		<!--查询条件表格-->
		<div class="listTab">
			<table>
				<thead>
					<tr>
						<td><a href="javascript:void(0);" onclick="javascript:selectAll();">全选</a></td>
						<td>类型编号</td>
						<td>当前状态</td>
						<td>短信提醒</td>
						<td>提醒间隔时间(单位：毫秒)</td>
						<td>最大提醒次数</td>
						<td>首次提醒</td>
						<td>备注</td>
						<td>操作</td>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="%{pm.list}" id="sysSetInfo">
					<tr>
						<td><input type="checkbox" name="chk" value="${bCode }" id="${bCode }" /></td>
						<td onclick="javascript:goDetail('${bCode }');" 
							style="cursor:pointer;" title="点击行看明细">${bCode }</td>
						<td onclick="javascript:goDetail('${bCode }');" style="cursor:pointer;" title="点击行看明细">
							<s:if test='#sysSetInfo.state == "1"'>
								<img src="<%=basePath%>style/icons/ok.png" title="启用" alt="启用"/>
							</s:if>
							<s:elseif test='#sysSetInfo.state == "2"'>
								<img src="<%=basePath%>style/icons/pause.png" title="停用" alt="停用"/>
							</s:elseif>
						</td>
						<td onclick="javascript:goDetail('${bCode }');" style="cursor:pointer;" title="点击行看明细">
							<s:if test='#sysSetInfo.isNote == "1"'>是</s:if>
							<s:elseif test='#sysSetInfo.isNote == "2"'>否</s:elseif>
						</td>
						<td onclick="javascript:goDetail('${bCode }');" style="cursor:pointer;" 
							title="点击行看明细" align="left">${spTime }</td>
						
						<td onclick="javascript:goDetail('${bCode }');" style="cursor:pointer;" 
							title="点击行看明细" align="left">
							<s:if test="#sysSetInfo.cueTime == 0">不限制</s:if>
							<s:else>${cueTime }</s:else>
						</td>
						<td onclick="javascript:goDetail('${bCode }');" style="cursor:pointer;" title="点击行看明细">
							<s:if test='#sysSetInfo.isFirst == "1"'>是</s:if>
							<s:elseif test='#sysSetInfo.isFirst == "2"'>否</s:elseif>
						</td>
						<td style="cursor:pointer;" title="点击行看明细" align="left" 
							onclick="javascript:goDetail('${bCode }');">${remark }</td>
						<td>
							<a href="javascript:void(0);" class="modi" 
								onclick="edit('<%=basePath%>basic/sys/msgSet_findOneByBcode.action?sysSetInfo.bCode=${bCode }&type=edit');">编辑</a>
							<a href="javascript:void(0);" class="return" onclick="deleteById('${bCode }', '<%=basePath%>basic/sys/msgSet_delete.action');">删除</a>
							<s:if test='#sysSetInfo.state == "1"'>
								<a href="javascript:void(0);" class="disc" 
									onclick="javascript:updateSysSetInfoState('${bCode }', '2');">停用</a>
							</s:if>
							<s:else>
								<a href="javascript:void(0);" class="enable" 
									onclick="javascript:updateSysSetInfoState('${bCode }', '1');">启用</a>
							</s:else>
						</td>
					</tr>
					</s:iterator>
					<s:if test="%{pm.list.size() == 0}">
					<tr>
						<td colspan="9"><font>暂时没有内容信息</font></td>
					</tr>
					</s:if>
				</tbody>
			</table>
		</div>
		<s:if test="%{pm.list.size() > 0}">
		<jsp:include page="/admin/common/pagemodel.jsp"></jsp:include>
		</s:if>
	</form>
</body>
</html>
